package top.huhuiyu.teachproject.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.huhuiyu.teachproject.base.BaseDataResult;
import top.huhuiyu.teachproject.entity.TbUser;
import top.huhuiyu.teachproject.service.AuthService;
import top.huhuiyu.teachproject.vo.UserInfo;

/**
 * 用户认证相关控制器
 *
 * @author 胡辉煜
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/auth")
public class AuthController {

  private final AuthService authService;

  @PostMapping("")
  public BaseDataResult<UserInfo> login(@RequestBody TbUser user) {
    return authService.login(user);
  }

  @GetMapping("")
  public BaseDataResult<UserInfo> loginInfo() {
    return authService.loginInfo();
  }

}
